﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml;

namespace RoboRun
{
    class Timer
    {
        DispatcherTimer currentTimer;
        public int timesTicked = 1;

        public void setupTimer()
        {
            currentTimer = new DispatcherTimer();
            currentTimer.Tick += currentTimer_Tick;
            currentTimer.Interval = new TimeSpan(0, 0, 1);
            currentTimer.Start();
            GameplayScreen.debugger.Text = "Timer started";

        }

        void currentTimer_Tick(object sender, object e)
        {
            if (GameplayScreen.playPressed)
            {
                //GameplayScreen.debugger.Text = "Game started. Ticks = " + timesTicked.ToString();
                currentTimer.Stop();
            }
            timesTicked++;
        }

        public void stopTimer()
        {
            currentTimer.Stop();
            GameplayScreen.debugger.Text = "Timer stopped. Ticks = " + timesTicked.ToString();
        }

        public int getTicks()
        {
            return timesTicked;
        }



    }
}
